package com.openbravo.pos.util;

import com.openbravo.pos.forms.AppLocal;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import javax.swing.text.JTextComponent;

public class DirectoryEvent
  implements ActionListener
{
  private JTextComponent m_jTxtField;
  private JFileChooser m_fc;

  public DirectoryEvent(JTextComponent paramJTextComponent)
  {
    this.m_jTxtField = paramJTextComponent;
    this.m_fc = new JFileChooser();
    this.m_fc.resetChoosableFileFilters();
    this.m_fc.addChoosableFileFilter(new FileFilter()
    {
      public boolean accept(File paramFile)
      {
        if (paramFile.isDirectory())
          return true;
        String str = paramFile.getName();
        return (str.endsWith(".jar")) || (str.endsWith(".JAR")) || (str.endsWith(".zip")) || (str.endsWith(".ZIP"));
      }

      public String getDescription()
      {
        return AppLocal.getIntString("filter.dbdriverlib");
      }
    });
    this.m_fc.setFileSelectionMode(0);
  }

  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this.m_fc.setCurrentDirectory(new File(this.m_jTxtField.getText()));
    if (this.m_fc.showOpenDialog(this.m_jTxtField) == 0)
      this.m_jTxtField.setText(this.m_fc.getSelectedFile().getAbsolutePath());
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.util.DirectoryEvent
 * JD-Core Version:    0.6.0
 */